/**
 * @author Administrator
 *
 */
package com.mblog.comment.service;

import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.mblog.comment.dao.MBlogCommentMapper;
import com.mblog.comment.entity.MBlogComment;
import com.mblog.util.PageBean;
import com.mblog.util.PageHelper;
import com.mblog.util.PageHelper.PageCall;

@Service("ArticleCommentService")
public class ArticleCommentServiceImp implements ArticleCommentService{

	@Resource
	private MBlogCommentMapper mBlogCommentMapper;
	@Override
	public int deleteByPrimaryKey(Integer id) {
		
		return mBlogCommentMapper.deleteByPrimaryKey(id);
	}

	@Override
	public int insert(MBlogComment record) {
		
		return mBlogCommentMapper.insert(record);
	}

	@Override
	public MBlogComment selectByPrimaryKey(Integer id) {
		
		return mBlogCommentMapper.selectByPrimaryKey(id);
	}

	@Override
	public List<MBlogComment> selectAll() {
		
		return mBlogCommentMapper.selectAll();
	}

	@Override
	public int updateByPrimaryKey(MBlogComment record) {
		
		return mBlogCommentMapper.updateByPrimaryKey(record);
	}

	@Override
	public PageBean selectAllCommentsByPage(int pageNum, int pageSize, final Map<String, Object> map) {
		return PageHelper.pagedQuery(new PageCall() {
			@Override
			public void executeQuery() {
				mBlogCommentMapper.selectAllComments(map);
			}
		}, pageNum, pageSize);

	}

	@Override
	public MBlogComment selectCommentsByParentid(int id) {
		
		return mBlogCommentMapper.selectCommentsByParentid(id);
	}

	@Override
	public int selectMaxSortByBlogId(Map<String, Object> map) {
		
		return mBlogCommentMapper.selectMaxSortByBlogId(map);
	}
	

}